home *** CD-ROM | disk | FTP | other *** search
/ IRIX Patches 1995 March / SGI IRIX Patches 1995 Mar.iso / 5.2_patches / patchSG0000226 / patchSG0000226.idb / usr / include / sys / EVEREST / evconfig.h.z / evconfig.h
Encoding:
C/C++ Source or Header  |  1995-03-10  |  11.0 KB  |  328 lines

  1. /**************************************************************************
  2.  *                                                                        *
  3.  *               Copyright (C) 1992, Silicon Graphics, Inc.               *
  4.  *                                                                        *
  5.  *  These coded instructions, statements, and computer programs  contain  *
  6.  *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  7.  *  are protected by Federal copyright law.  They  may  not be disclosed  *
  8.  *  to  third  parties  or copied or duplicated in any form, in whole or  *
  9.  *  in part, without the prior written consent of Silicon Graphics, Inc.  *
  10.  *                                                                        *
  11.  **************************************************************************/
  12.  
  13. /*
  14.  * evconfig.h -- Contains information about various bits of Everest system 
  15.  *         hardware.  This data is acquired by the PROM and
  16.  *         is passed up to the kernel and standalone programs
  17.  *         through the data structures described in this file.
  18.  * 
  19.  * NOTE:
  20.  *    If diagval == 0x00, then component passed diags.
  21.  *    If diagval == 0xff, the component is non-existent.
  22.  *
  23.  *     For all other values of diagval, component was found but
  24.  *       failed diagnostics.  It is possible that diagval is
  25.  *       non-zero but that a component is still enabled.  In 
  26.  *       this case, only part of a component (such as one of the
  27.  *       uarts on the EPC) has failed.  The diagval should be 
  28.  *        sufficient to determine which sub-component failed in this
  29.  *       case. 
  30.  *
  31.  * WARNING:
  32.  *    Certain assembly language routines (notably slave.s) in the PROM 
  33.  *    depend on the format of this data.  In some cases, rearranging 
  34.  *    the fields can seriously break things.   
  35.  */
  36.  
  37. #ifndef __SYS_EVEREST_EVCONFIG_H__
  38. #define __SYS_EVEREST_EVCONFIG_H__
  39.  
  40. #ident "$Revision: 1.37 $"
  41.  
  42. #ifdef _LANGUAGE_C
  43. #include <sys/types.h>
  44. #include <sys/loaddrs.h>
  45. #include <sys/EVEREST/everest.h>
  46. #include <sys/EVEREST/mc3.h>
  47. #include <sys/EVEREST/io4.h>
  48. #else
  49. #include <sys/EVEREST/everest.h>
  50. #endif /* _LANGUAGE_C */
  51.  
  52. #include <sys/EVEREST/evdiag.h>
  53.  
  54. #define EVCFGINFO_MAGIC    0xdeadbabe
  55.  
  56. #define BLOC_SIZE    256
  57. #define BLOCs_to_pages(x) ((x)>>(4+PGSHFTFCTR))
  58. #define SERIALNUMSIZE 11
  59.  
  60.  
  61. /*
  62.  * Offsets in NVRAM used to retrieve configuration information.
  63.  */
  64.  
  65. #define INV_MAXUNITS    8 
  66. #define INV_UNITSIZE    3
  67. #define INV_SIZE        (4 + (INV_MAXUNITS * INV_UNITSIZE))
  68.  
  69. #define INV_TYPE        0
  70. #define INV_REV         1
  71. #define INV_DIAGVAL     2
  72. #define INV_ENABLE      3
  73. #define INV_UNITOFF    4
  74.  
  75. #define INVU_TYPE    0
  76. #define INVU_DIAGVAL    1
  77. #define INVU_ENABLE    2
  78.  
  79. /*
  80.  * Everest board types and classes
  81.  */
  82. #define EVCLASS_MASK    0xf0
  83. #define EVCLASS_NONE    0x00
  84. #define EVCLASS_CPU    0x10
  85. #define EVCLASS_IO    0x20
  86. #define EVCLASS_MEM    0x30
  87. #define EVCLASS_UNKNOWN    0xf0
  88.  
  89. #define EVCLASS(_x) ((_x) & EVCLASS_MASK)
  90.  
  91. #define EVTYPE_MASK    0x0f
  92. #define EVTYPE_NONE    0x00
  93. #define EVTYPE_EMPTY    0x00
  94.  
  95. #define EVTYPE_WEIRDCPU (EVCLASS_CPU | 0x0)
  96. #define EVTYPE_IP19    (EVCLASS_CPU | 0x1)
  97. #define EVTYPE_IP21    (EVCLASS_CPU | 0x2)
  98. #define EVTYPE_IP23    (EVCLASS_CPU | 0x3)
  99.  
  100. #define EVTYPE_WEIRDIO    (EVCLASS_IO  | 0x0)
  101. #define EVTYPE_IO4    (EVCLASS_IO  | 0x1)
  102. #define EVTYPE_IO5    (EVCLASS_IO  | 0x2)
  103.  
  104. #define EVTYPE_WEIRDMEM (EVCLASS_MEM | 0x0)    
  105. #define EVTYPE_MC3    (EVCLASS_MEM | 0x1)
  106.  
  107. #define EVTYPE_UNKNOWN    0xff
  108.  
  109. #define EVTYPE(_x)     ((_x) & EVTYPE_MASK)
  110. /*
  111.  * Standard diagnostic return values - all others indicate errors.
  112.  */
  113. #define EVDIAG_PASSED    0x0
  114. #define EVDIAG_TBD    0xfd
  115. #define EVDIAG_NOT_SET    0xfe
  116. #define EVDIAG_NOTFOUND    0xff
  117.  
  118. #define EVINV_DISABLED    1
  119.  
  120. #define CPUST_NORESP    ((unchar) 0xff)
  121.  
  122. #ifdef _LANGUAGE_C
  123.  
  124. /*
  125.  * The evioacfg_t structure type contains configuration information
  126.  * for the IO adapters on IO4 boards.  If you add fields to this 
  127.  * structure, make sure you update the BRDINFO_SIZE definition in the 
  128.  * Assembler ifdef below.
  129.  */
  130. typedef struct evioacfg_s {
  131.     ulong    pad;
  132.     unchar    ioa_enable;    /* Flag indicating whether IOA is enabled */
  133.     unchar    ioa_inventory;    /* Previous type info from NVRAM inventory */
  134.     unchar    ioa_diagval;    /* Results of diagnostic for this IOA */
  135.     unchar    ioa_type;    /* The adapter type (see io4.h) */
  136.     unchar    ioa_virtid;    /* The virtual ID for this type */
  137.     unchar    ioa_subtype;    /* The ID of the device on flat cable */
  138. } evioacfg_t; 
  139.  
  140.  
  141. /*
  142.  * The evbnkcfg_t structure type contains configuration information
  143.  * for the banks on MC3 boards.  If you add fields to this structure,
  144.  * make sure you update the BRDINFO_SIZE definition in the Assembler
  145.  * ifdef below.
  146.  */
  147. #define bnk_used bnk_ip
  148. #define bnk_next bnk_if
  149. typedef struct evbnkcfg_s {
  150.     ulong    bnk_bloc;    /* Bloc num of memory range containing bank */
  151.     unchar    bnk_slot;    /* Slot of this bank */
  152.     unchar    bnk_enable;    /* Flag indicating bank is enabled */
  153.     unchar    bnk_inventory;    /* Previous type info from NVRAM inventory */
  154.     unchar    bnk_diagval;    /* Results of diagnostics for the bank */
  155.     unchar    bnk_ip;        /* Bank interleave position */
  156.     unchar    bnk_if;        /* Bank interleave factor */
  157.     unchar      bnk_size;    /* Size of bank */
  158.     unchar    bnk_count;    /* Number of banks in this interleave */
  159. } evbnkcfg_t;
  160.  
  161.     
  162. /*
  163.  * The evcpucfg_t structure contains configuration information 
  164.  * for the cpus on the IP19 and IP21 boards.  If you add fields
  165.  * to this structure, make sure you update both the BRDINFO_SIZE and
  166.  * CPUCFG_SIZE efinitions in the Assember ifdef below.
  167.  */
  168.  
  169. typedef struct evcpucfg_s {
  170.     ulong    cpu_launch;    /* Launch address */
  171.     ulong    cpu_parm;    /* Launch parameter */
  172.     unchar    cpu_info;    /* Processor status when cpu_diagval is zero,
  173.                  * Diagnostic info when cpu_diagval is set
  174.                  */
  175.     unchar    cpu_enable;    /* Flag indicating CPU is enabled */
  176.     unchar     cpu_inventory;    /* Bits indicating inventory status */
  177.     unchar    cpu_diagval;    /* Results of diagnostic for this CPU */
  178.     unchar    cpu_vpid;    /* Virtual processor ID of the CPU */
  179.     unchar    cpu_speed;    /* Processor's frequency (in MHz) */
  180.     unchar    cpu_cachesz;    /* log2(Secondary cache size) */
  181.     unchar    cpu_promrev;    /* CPU prom revision */
  182. } evcpucfg_t;
  183.  
  184. /*
  185.  * The evbrdinfo_t structure contains all pertinent information for
  186.  * a given board in the system.  It contains a union which has structures
  187.  * for each of the major board types.  DO NOT ADD FIELDS BEFORE THE UNION.
  188.  * THE ASSEMBLY LANGUAGE DEFINES DEPEND ON IT BEING THE FIRST ELEMENT IN
  189.  * THE STRUCTURE.
  190.  */
  191.  
  192. #define eb_io        eb_un.ebun_io
  193. #define eb_ioarr    eb_un.ebun_io.eb_ioas
  194. #define eb_cpu      eb_un.ebun_cpu
  195. #define eb_cpuarr    eb_un.ebun_cpu.eb_cpus
  196. #define eb_mem        eb_un.ebun_mem
  197. #define eb_banks    eb_un.ebun_mem.ebun_banks
  198.  
  199. typedef struct evbrdinfo_s {
  200.     union {            /* Union containing board info structures */
  201.     struct {
  202.         evioacfg_t    eb_ioas[IO4_MAX_PADAPS];  /* IO adapter information */
  203.         unchar    eb_winnum;          /* IO window assigned */
  204.     } ebun_io;
  205.  
  206.     struct {
  207.         evbnkcfg_t    ebun_banks[MC3_NUM_BANKS]; /* Bank information */
  208.         unchar    eb_mc3num;           /* virtual mc3 id assigned */
  209.     } ebun_mem;
  210.  
  211.     struct {
  212.             evcpucfg_t    eb_cpus[EV_MAX_CPUS_BOARD];/* Processor information */ 
  213.         unchar    eb_cpunum;
  214.         unchar    eb_numcpus;           /* Number of CPUS on board */
  215.         unchar    eb_ccrev;           /* Cache controller rev. */
  216.         unchar    eb_brdflags;           /* Board config flags. */
  217.     } ebun_cpu;
  218.     } eb_un;
  219.  
  220.     unchar    eb_type;    /* Type of board in this slot */
  221.     unchar    eb_rev;        /* Board revision (if available) */
  222.     unchar    eb_enabled;    /* Flag indicating board is enabled */
  223.     unchar    eb_inventory;    /* Previous type info from NVRAM inventory */
  224.     unchar    eb_diagval;    /* Results of general board diags */
  225.     unchar    eb_slot;    /* Slot containing this board */
  226. } evbrdinfo_t;
  227.  
  228. /*
  229.  * The following are flags that can be set in eb_brdflags:
  230.  */
  231. #define EV_BFLAG_PIGGYBACK    0x01    /* Piggyback reads are enabled. */
  232.  
  233. /*
  234.  * The evcfginfo_t structure contains all of the configuration information
  235.  * the kernel needs to manage an Everest system.  An instance of this struct 
  236.  * exists at a fixed address in memory (see EVCFGINFO) and is initialized by 
  237.  * the Everest PROM.  DO NOT ADD FIELDS BEFORE ecfg_board or ecfg_debugsw!
  238.  * THE ASSEMBLY LANGUAGE DEPENDS ON THE IMPLICIT ORDERINGS OF THIS DATA. 
  239.  */
  240.     
  241. typedef struct evcfginfo_s {
  242.     evbrdinfo_t    ecfg_board[EV_MAX_SLOTS]; 
  243.     ulong    ecfg_magic;    /* Magic number for the cfg structure */
  244.     ulong    ecfg_secs;    /* Clock start time (in secs since YRREF) */
  245.     ulong    ecfg_nanosecs;    /* Clock start time (remainder in ns) */
  246.     ulong    ecfg_clkfreq;    /* Bus clock frequency (in Hz) */
  247.     ulong     ecfg_memsize;    /* Memory size, in 256-byte blocs */
  248.     ulong    ecfg_epcioa;    /* IO Adapter of master EPC */
  249.     ulong    ecfg_debugsw;    /* Value of the "virtual DIP switches" when
  250.                    the system was powered on. */
  251.     char    ecfg_snum[SERIALNUMSIZE];  /* Everest serial number */
  252. } evcfginfo_t;
  253.  
  254. #define YRREF 1970        /* clock relative to 01/01/1970 */
  255.     
  256. #define BOARD(_x) ((evbrdinfo_t *)(EVCFGINFO_ADDR + ((_x) * BRDINFO_SIZE)))
  257.  
  258. /*
  259.  * Create a pointer to the everest configuration information block.
  260.  */
  261. #define EVCFGINFO    ((evcfginfo_t*)EVCFGINFO_ADDR)
  262.  
  263. /*
  264.  * Returns logical cpuid assigned by PROM
  265.  */
  266. #define EVCFG_CPUID(_slot, _cpu) \
  267.     (EVCFGINFO->ecfg_board[(_slot)].eb_cpu.eb_cpus[(_cpu)].cpu_vpid)
  268.  
  269. /*
  270.  * Returns results of cpu diagnostics run by PROM.
  271.  * Non-zero indicates that this CPU failed diags, and cannot be enabled.
  272.  */
  273. #define EVCFG_CPUDIAGVAL(_slot, _cpu) \
  274.     (EVCFGINFO->ecfg_board[(_slot)].eb_cpu.eb_cpus[(_cpu)].cpu_diagval)
  275.  
  276. /*
  277.  * Returns processor speed (in Mhz), according to PROM configuration 
  278.  * information.
  279.  */
  280. #define EVCFG_CPUSPEED(_slot, _cpu) \
  281.     (EVCFGINFO->ecfg_board[(_slot)].eb_cpu.eb_cpus[(_cpu)].cpu_speed)
  282.  
  283. /*
  284.  * Returns the revision number (one byte) of the CPU PROM on the specified CPU.
  285.  */
  286. #define EVCFG_CPUPROMREV(_slot, _cpu) \
  287.     (EVCFGINFO->ecfg_board[(_slot)].eb_cpu.eb_cpus[(_cpu)].cpu_promrev)
  288.  
  289. /*
  290.  * Returns the cpu structure for the cpu specified.
  291.  */
  292. #define EVCFG_CPUSTRUCT(_slot, _cpu) \
  293.     (EVCFGINFO->ecfg_board[(_slot)].eb_cpu.eb_cpus[(_cpu)])
  294.  
  295. #endif /* _LANGUAGE_C */
  296.  
  297. /* Virtual dipswitch values (starting from switch "7"): */
  298. #define VDS_NOGFX        0x8000    /* Don't enable gfx and autoboot */
  299. #define VDS_NOMP        0x100    /* Don't start slave processors */
  300. #define VDS_MANUMODE        0x80    /* Manufacturing mode */
  301. #define VDS_NOARB        0x40    /* No bootmaster arbitration */
  302. #define VDS_PODMODE        0x20    /* Go straight to POD mode */
  303. #define VDS_NO_DIAGS        0x10    /* Don't run any diags after BM arb */
  304. #define VDS_DEFAULTS        0x08    /* Use default environment values */
  305. #define VDS_NOMEMCLEAR        0x04    /* Don't run mem cfg code */
  306. #define VDS_2ND_IO4        0x02    /* Boot from the second IO4 */
  307. #define VDS_DEBUG_PROM        0x01    /* Print PROM debugging messages */
  308.  
  309. #define BRDINFO_SIZE        108
  310.  
  311. #ifdef _LANGUAGE_ASSEMBLY
  312. #  define DEBUGSW_OFF        (BRDINFO_SIZE * EV_MAX_SLOTS + 24)
  313. #  define CPUINFO_SIZE        16    
  314. #  define CPULAUNCH_OFF        0
  315. #  define CPUPARM_OFF        4
  316. #  define CPUSTATUS_OFF        8    
  317. #  define CPUENABLE_OFF        9
  318. #  define CPUINVENT_OFF        10
  319. #  define CPUDIAGVAL_OFF    11
  320. #  define CPUVPID_OFF        12
  321. #  define CPUSPEED_OFF        13 
  322. #  define CPUCACHE_OFF        14 
  323. #  define CPUPROMREV_OFF    15
  324. #endif /* _LANGUAGE_ASSEMBLY */
  325.  
  326.  
  327. #endif /* __SYS_EVEREST_EVCONFIG_H__ */
  328.